package com.msmall.community.roster.model;

import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.msmall.base.model.BaseObject;

/**
 * 用户拥有的好友组
 * 一个用户拥有的组不能同名
 * 默认拥有4个组：此4个组组名不可修改，不可删除
 * 1,好友(好友关系) ConstantDB.ROSTER_GROUP_NAME_FRIENDS
 * 2,陌生人(请求/拒绝) ConstantDB.ROSTER_GROUP_NAME_STRANGER
 * 3,黑名单(主动发起黑名单操作方) ConstantDB.ROSTER_GROUP_NAME_BLACKLIST
 * 4,被黑名单(黑名单被动方，不被用户查看到) ConstantDB.ROSTER_GROUP_NAME_FORBIDDEN
 */
@Entity
@Table(name="base_user_roster_group")
public class RosterGroup extends BaseObject{

	private static final long serialVersionUID = -2024216079815136724L;

	@Id
	@Column(name="groupid",insertable=false,updatable=false)
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Long groupid;
	
	/**
	 * 拥有者
	 */
	@Column(name="userid")
	private Long userid;
	
	/**
	 * 组登记
	 */
	@Column(name="rank")
	private Integer rank;
	/**
	 * 好友组名
	 */
	@Column(name="name")
	private String name;
	
	@OneToMany(cascade = {CascadeType.PERSIST,CascadeType.MERGE},fetch=FetchType.LAZY, mappedBy="group")
	private Set<Roster> groupUsers;
	
	public Long getGroupid() {
		return groupid;
	}

	public void setGroupid(Long groupid) {
		this.groupid = groupid;
	}

	public Long getUserid() {
		return userid;
	}

	public void setUserid(Long userid) {
		this.userid = userid;
	}

	public Integer getRank() {
		return rank;
	}

	public void setRank(Integer rank) {
		this.rank = rank;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<Roster> getGroupUsers() {
		return groupUsers;
	}

	public void setGroupUsers(Set<Roster> groupUsers) {
		this.groupUsers = groupUsers;
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return null;
	}

}
